package main

import "fmt"

// Author : CSR丶WARRIOR
// Time ： 2020/10/20  23:13
// TOOLS : GoLand
// FILENAME : recoverDemo.go
// STATEMENT: recover函数的使用

func main() {
	Test1(11)
}
func Test1(n int) {
	defer TestRecover()
	var num [10]int
	num[n] = 12
	fmt.Println(num)
	fmt.Println("aaaaa")

}
func TestRecover() {
	fmt.Println(recover()) //runtime error: index out of range [11] with length 10
}
